<?php

namespace Common\Models\Videos;

use Phalcon\Mvc\Model;
use Phalcon\Mvc\Model\Validator\Uniqueness;
use Phalcon\Mvc\Model\Resultset\Simple;

class HomeCategory extends Model
    {
        /**
         *
         * @var integer
         */
        protected $id;

        /**
         *
         * @var string
         */
        protected $name;


        /**
         *
         * @var string
         */
        protected $description;

        protected $status;


        public function getSource()
        {
            return 'home_category';
        }

        public function initialize(){

        }

        public function afterDelete()
        {
            $this->clearCache();
        }

        public function afterSave()
        {
            $this->clearCache();   
        }
        public function clearCache()
        {
            if ($this->id) {
                $modelsCache = $this->getDI()->getModelsCache();
                $modelsCache->delete($this->constant->keyCache['homeCategory']['category']);            
            }
        }

        /**
         * @return int
         */
        public function getId()
        {
            return $this->id;
        }

        /**
         * @param int $id
         */
        public function setId($id)
        {
            $this->id = $id;
        }

        /**
         * @return string
         */
        public function getDescription()
        {
            return $this->description;
        }

        /**
         * @param string $description
         */
        public function setDescription($description)
        {
            $this->description = $description;
        }

        /**
         * @return string
         */
        public function getName()
        {
            return $this->name;
        }

        /**
         * @param string $name
         */
        public function setName($name)
        {
            $this->name = $name;
        }

        /**
         * @return mixed
         */
        public function getStatus()
        {
            return $this->status;
        }

        /**
         * @param mixed $status
         */
        public function setStatus($status)
        {
            $this->status = $status;
        }

    }